package com.vichat.user.util;

import com.vichat.common.constant.GlobalConstant;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;

/**
 * Created by ranjx on 2017/10/13.
 */
public class SessionUtils {

    public static String getSessionCaptcha(HttpServletRequest request) {
        HttpSession session = request.getSession(true);
        Object obj = session.getAttribute(GlobalConstant.SESSION_KEY_CAPTCHA);
        if (obj != null) {
            return (String) obj;
        }
        return null;
    }

    public static void setSessionCaptcha(HttpServletRequest request, String captcha) {
        request.getSession(true).setAttribute(GlobalConstant.SESSION_KEY_CAPTCHA, captcha);
    }
}
